package com.example.pojo.entity.validate;

import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @time 2019/9/3 17:30
 */
@Data
public class EmpEntity implements Serializable {

    private static final long serialVersionUID = -176271593732292209L;
    /**
     * 主键ID
     */
    private int eid;
    /**
     * 姓名
     */
    @NotNull(message = "名字不能为空")
    private String ename;
    /**
     * 爱好
     */
    private String ehob;
    /**
     * 年龄
     */
    @Max(value = 100, message = "年龄有点大哟")
    @Min(value = 0, message = "年龄有问题")
    private int age;

    /**
     * 性别
     */
    @Range(min = 0, max = 1, message = "性别验证不通过")
    private int sex;

    @Pattern(regexp = "^\\s*|((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\\d{8}$", message = "手机号验证不通过")
    private String mobile;
    /**
     * 对Integer类型不能使用@NotBlank验证
     */
    @NotNull(message = "人员状态不能为空")
    private Integer status;


    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;


}
